﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jumpton.SFA.Server.BusinessRule;
using com.SFA.Server.Entity;
using Jumpton.Data;
using Jumpton.Persistent;

namespace BusinessRule.WareHouse
{
    public class InventoryManager:BusinessLogic
    {
        public INVENTORY Load(decimal ProductID, decimal WareID, String Unit)
        {
            return (INVENTORY)ObjectRow.Load(typeof(INVENTORY), "ACTIVE=1 AND PRODUCT_ID=" + ProductID + " AND WARE_ID=" + WareID + " AND UNIT='" + Unit + "'");
        }

        public global::System.Data.DataTable QueryInventory(String condition,decimal DOMAINID)
        {
            String SQL = "SELECT T1.*,T2.SHORT_DESCRIPTION,T2.CODE,T3.DESCRIPTION FROM INVENTORY T1,PRODUCTS T2, WAREHOUSE T3 WHERE T1.PRODUCT_ID=T2.ID AND T1.WARE_ID=T3.ID AND T1.ACTIVE=1 AND T1.DOMAIN_ID=" + DOMAINID;
            return SqlData.OpenSql(SQL).Tables[0];
        }
    }
}
